import isLogin from "@/utils/isLogin";
import LoginFooterVue from "@/views/login/components/LoginFooter.vue";
import type { NavigationGuardNext, RouteLocationNormalized } from "vue-router";


export default function authGuard(
    to:RouteLocationNormalized,
    from:RouteLocationNormalized,
    next:NavigationGuardNext
){
    //创建路由白名单
    const allowPath = ["/", "/login", "/login/callback"];  
     // 如果用户访问的是需要登录的页面并且他还没登录
     if(!allowPath.includes(to.path) && !isLogin()){
        next({path:'/login',query:{return: to.fullPath}})
     }else{
        next()
     }
}